Integrand size = 23, antiderivative size = 111 \[ \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx=\frac {\left (a^2 A-A b^2+2 a b B\right ) x}{\left (a^2+b^2\right )^2}+\frac {A b-a B}{\left (a^2+b^2\right ) d (a+b \cot (c+d x))}-\frac {\left (2 a A b-a^2 B+b^2 B\right ) \log (b \cos (c+d x)+a \sin (c+d x))}{\left (a^2+b^2\right )^2 d} \]
(A*a^2-A*b^2+2*B*a*b)*x/(a^2+b^2)^2+(A*b-B*a)/(a^2+b^2)/d/(a+b*cot(d*x+c)) -(2*A*a*b-B*a^2+B*b^2)*ln(b*cos(d*x+c)+a*sin(d*x+c))/(a^2+b^2)^2/d
Result contains complex when optimal does not.
Time = 2.13 (sec) , antiderivative size = 144, normalized size of antiderivative = 1.30 \[ \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx=\frac {-\frac {(i A+B) \log (i-\tan (c+d x))}{(a-i b)^2}+\frac {i (A+i B) \log (i+\tan (c+d x))}{(a+i b)^2}+\frac {2 \left (-2 a A b+a^2 B-b^2 B\right ) \log (b+a \tan (c+d x))}{\left (a^2+b^2\right )^2}+\frac {2 b (-A b+a B)}{a \left (a^2+b^2\right ) (b+a \tan (c+d x))}}{2 d} \]
(-(((I*A + B)*Log[I - Tan[c + d*x]])/(a - I*b)^2) + (I*(A + I*B)*Log[I + T an[c + d*x]])/(a + I*b)^2 + (2*(-2*a*A*b + a^2*B - b^2*B)*Log[b + a*Tan[c + d*x]])/(a^2 + b^2)^2 + (2*b*(-(A*b) + a*B))/(a*(a^2 + b^2)*(b + a*Tan[c + d*x])))/(2*d)
Time = 0.54 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.10, number of steps used = 7, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.304, Rules used = {3042, 4012, 3042, 4014, 25, 3042, 4013}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {A-B \tan \left (c+d x+\frac {\pi }{2}\right )}{\left (a-b \tan \left (c+d x+\frac {\pi }{2}\right )\right )^2}dx\) |
\(\Big \downarrow \) 4012 |
\(\displaystyle \frac {\int \frac {a A+b B-(A b-a B) \cot (c+d x)}{a+b \cot (c+d x)}dx}{a^2+b^2}+\frac {A b-a B}{d \left (a^2+b^2\right ) (a+b \cot (c+d x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a A+b B-(a B-A b) \tan \left (c+d x+\frac {\pi }{2}\right )}{a-b \tan \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2+b^2}+\frac {A b-a B}{d \left (a^2+b^2\right ) (a+b \cot (c+d x))}\) |
\(\Big \downarrow \) 4014 |
\(\displaystyle \frac {\frac {x \left (a^2 A+2 a b B-A b^2\right )}{a^2+b^2}-\frac {\left (a^2 (-B)+2 a A b+b^2 B\right ) \int -\frac {b-a \cot (c+d x)}{a+b \cot (c+d x)}dx}{a^2+b^2}}{a^2+b^2}+\frac {A b-a B}{d \left (a^2+b^2\right ) (a+b \cot (c+d x))}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {\frac {\left (a^2 (-B)+2 a A b+b^2 B\right ) \int \frac {b-a \cot (c+d x)}{a+b \cot (c+d x)}dx}{a^2+b^2}+\frac {x \left (a^2 A+2 a b B-A b^2\right )}{a^2+b^2}}{a^2+b^2}+\frac {A b-a B}{d \left (a^2+b^2\right ) (a+b \cot (c+d x))}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {\left (a^2 (-B)+2 a A b+b^2 B\right ) \int \frac {b+a \tan \left (c+d x+\frac {\pi }{2}\right )}{a-b \tan \left (c+d x+\frac {\pi }{2}\right )}dx}{a^2+b^2}+\frac {x \left (a^2 A+2 a b B-A b^2\right )}{a^2+b^2}}{a^2+b^2}+\frac {A b-a B}{d \left (a^2+b^2\right ) (a+b \cot (c+d x))}\) |
\(\Big \downarrow \) 4013 |
\(\displaystyle \frac {A b-a B}{d \left (a^2+b^2\right ) (a+b \cot (c+d x))}+\frac {\frac {x \left (a^2 A+2 a b B-A b^2\right )}{a^2+b^2}-\frac {\left (a^2 (-B)+2 a A b+b^2 B\right ) \log (a \sin (c+d x)+b \cos (c+d x))}{d \left (a^2+b^2\right )}}{a^2+b^2}\) |
(A*b - a*B)/((a^2 + b^2)*d*(a + b*Cot[c + d*x])) + (((a^2*A - A*b^2 + 2*a* b*B)*x)/(a^2 + b^2) - ((2*a*A*b - a^2*B + b^2*B)*Log[b*Cos[c + d*x] + a*Si n[c + d*x]])/((a^2 + b^2)*d))/(a^2 + b^2)
3.1.93.3.1 Defintions of rubi rules used
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/ (f*(m + 1)*(a^2 + b^2))), x] + Simp[1/(a^2 + b^2) Int[(a + b*Tan[e + f*x] )^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a , b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1 ]
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* (x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a *d)/(a^2 + b^2) Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && N eQ[a*c + b*d, 0]
Time = 0.12 (sec) , antiderivative size = 147, normalized size of antiderivative = 1.32
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (2 A a b -B \,a^{2}+B \,b^{2}\right ) \ln \left (\cot \left (d x +c \right )^{2}+1\right )}{2}+\left (-A \,a^{2}+A \,b^{2}-2 B a b \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {A b -B a}{\left (a^{2}+b^{2}\right ) \left (a +b \cot \left (d x +c \right )\right )}-\frac {\left (2 A a b -B \,a^{2}+B \,b^{2}\right ) \ln \left (a +b \cot \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(147\) |
default | \(\frac {\frac {\frac {\left (2 A a b -B \,a^{2}+B \,b^{2}\right ) \ln \left (\cot \left (d x +c \right )^{2}+1\right )}{2}+\left (-A \,a^{2}+A \,b^{2}-2 B a b \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )}{\left (a^{2}+b^{2}\right )^{2}}+\frac {A b -B a}{\left (a^{2}+b^{2}\right ) \left (a +b \cot \left (d x +c \right )\right )}-\frac {\left (2 A a b -B \,a^{2}+B \,b^{2}\right ) \ln \left (a +b \cot \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{d}\) | \(147\) |
parallelrisch | \(\frac {-2 \left (A a b -\frac {1}{2} B \,a^{2}+\frac {1}{2} B \,b^{2}\right ) a \left (a \tan \left (d x +c \right )+b \right ) \ln \left (a \tan \left (d x +c \right )+b \right )+\left (A a b -\frac {1}{2} B \,a^{2}+\frac {1}{2} B \,b^{2}\right ) a \left (a \tan \left (d x +c \right )+b \right ) \ln \left (\sec \left (d x +c \right )^{2}\right )+a^{2} d x \left (A \,a^{2}-A \,b^{2}+2 B a b \right ) \tan \left (d x +c \right )+b \left (\left (A d x +B \right ) a^{3}-b \left (-2 B d x +A \right ) a^{2}-b^{2} \left (A d x -B \right ) a -A \,b^{3}\right )}{\left (a \tan \left (d x +c \right )+b \right ) d \left (a^{2}+b^{2}\right )^{2} a}\) | \(184\) |
norman | \(\frac {\frac {b \left (A \,a^{2}-A \,b^{2}+2 B a b \right ) x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {a \left (A \,a^{2}-A \,b^{2}+2 B a b \right ) x \tan \left (d x +c \right )}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {\left (A b -B a \right ) b}{a d \left (a^{2}+b^{2}\right )}}{a \tan \left (d x +c \right )+b}+\frac {\left (2 A a b -B \,a^{2}+B \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {\left (2 A a b -B \,a^{2}+B \,b^{2}\right ) \ln \left (a \tan \left (d x +c \right )+b \right )}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(222\) |
risch | \(\frac {i x B}{2 i a b +a^{2}-b^{2}}+\frac {x A}{2 i a b +a^{2}-b^{2}}+\frac {4 i A a b x}{a^{4}+2 a^{2} b^{2}+b^{4}}-\frac {2 i B \,a^{2} x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {2 i B \,b^{2} x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {4 i A a b c}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {2 i B \,a^{2} c}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 i B \,b^{2} c}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 i b^{2} A}{\left (i a +b \right ) d \left (-i a +b \right )^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )} b -i {\mathrm e}^{2 i \left (d x +c \right )} a +b +i a \right )}-\frac {2 i b B a}{\left (i a +b \right ) d \left (-i a +b \right )^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )} b -i {\mathrm e}^{2 i \left (d x +c \right )} a +b +i a \right )}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {i b -a}{i b +a}\right ) A a b}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {i b -a}{i b +a}\right ) B \,a^{2}}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {i b -a}{i b +a}\right ) B \,b^{2}}{d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) | \(474\) |
1/d*(1/(a^2+b^2)^2*(1/2*(2*A*a*b-B*a^2+B*b^2)*ln(cot(d*x+c)^2+1)+(-A*a^2+A *b^2-2*B*a*b)*(1/2*Pi-arccot(cot(d*x+c))))+(A*b-B*a)/(a^2+b^2)/(a+b*cot(d* x+c))-(2*A*a*b-B*a^2+B*b^2)/(a^2+b^2)^2*ln(a+b*cot(d*x+c)))
Leaf count of result is larger than twice the leaf count of optimal. 340 vs. \(2 (111) = 222\).
Time = 0.30 (sec) , antiderivative size = 340, normalized size of antiderivative = 3.06 \[ \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx=\frac {2 \, B a^{2} b - 2 \, A a b^{2} + 2 \, {\left (A a^{2} b + 2 \, B a b^{2} - A b^{3}\right )} d x + 2 \, {\left (B a^{2} b - A a b^{2} + {\left (A a^{2} b + 2 \, B a b^{2} - A b^{3}\right )} d x\right )} \cos \left (2 \, d x + 2 \, c\right ) + {\left (B a^{2} b - 2 \, A a b^{2} - B b^{3} + {\left (B a^{2} b - 2 \, A a b^{2} - B b^{3}\right )} \cos \left (2 \, d x + 2 \, c\right ) + {\left (B a^{3} - 2 \, A a^{2} b - B a b^{2}\right )} \sin \left (2 \, d x + 2 \, c\right )\right )} \log \left (a b \sin \left (2 \, d x + 2 \, c\right ) + \frac {1}{2} \, a^{2} + \frac {1}{2} \, b^{2} - \frac {1}{2} \, {\left (a^{2} - b^{2}\right )} \cos \left (2 \, d x + 2 \, c\right )\right ) - 2 \, {\left (B a b^{2} - A b^{3} - {\left (A a^{3} + 2 \, B a^{2} b - A a b^{2}\right )} d x\right )} \sin \left (2 \, d x + 2 \, c\right )}{2 \, {\left ({\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} d \cos \left (2 \, d x + 2 \, c\right ) + {\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} d \sin \left (2 \, d x + 2 \, c\right ) + {\left (a^{4} b + 2 \, a^{2} b^{3} + b^{5}\right )} d\right )}} \]
1/2*(2*B*a^2*b - 2*A*a*b^2 + 2*(A*a^2*b + 2*B*a*b^2 - A*b^3)*d*x + 2*(B*a^ 2*b - A*a*b^2 + (A*a^2*b + 2*B*a*b^2 - A*b^3)*d*x)*cos(2*d*x + 2*c) + (B*a ^2*b - 2*A*a*b^2 - B*b^3 + (B*a^2*b - 2*A*a*b^2 - B*b^3)*cos(2*d*x + 2*c) + (B*a^3 - 2*A*a^2*b - B*a*b^2)*sin(2*d*x + 2*c))*log(a*b*sin(2*d*x + 2*c) + 1/2*a^2 + 1/2*b^2 - 1/2*(a^2 - b^2)*cos(2*d*x + 2*c)) - 2*(B*a*b^2 - A* b^3 - (A*a^3 + 2*B*a^2*b - A*a*b^2)*d*x)*sin(2*d*x + 2*c))/((a^4*b + 2*a^2 *b^3 + b^5)*d*cos(2*d*x + 2*c) + (a^5 + 2*a^3*b^2 + a*b^4)*d*sin(2*d*x + 2 *c) + (a^4*b + 2*a^2*b^3 + b^5)*d)
Result contains complex when optimal does not.
Time = 1.62 (sec) , antiderivative size = 3964, normalized size of antiderivative = 35.71 \[ \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx=\text {Too large to display} \]
Piecewise((zoo*x*(A + B*cot(c))/cot(c)**2, Eq(a, 0) & Eq(b, 0) & Eq(d, 0)) , ((-A*x + A*tan(c + d*x)/d + B*log(tan(c + d*x)**2 + 1)/(2*d))/b**2, Eq(a , 0)), (A*d*x*cot(c + d*x)**2/(4*a**2*d*cot(c + d*x)**2 + 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) + 2*I*A*d*x*cot(c + d*x)/(4*a**2*d*cot(c + d*x)**2 + 8 *I*a**2*d*cot(c + d*x) - 4*a**2*d) - A*d*x/(4*a**2*d*cot(c + d*x)**2 + 8*I *a**2*d*cot(c + d*x) - 4*a**2*d) - A*cot(c + d*x)/(4*a**2*d*cot(c + d*x)** 2 + 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - 2*I*A/(4*a**2*d*cot(c + d*x)**2 + 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) + I*B*d*x*cot(c + d*x)**2/(4*a**2*d* cot(c + d*x)**2 + 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - 2*B*d*x*cot(c + d* x)/(4*a**2*d*cot(c + d*x)**2 + 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - I*B*d *x/(4*a**2*d*cot(c + d*x)**2 + 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - I*B*c ot(c + d*x)/(4*a**2*d*cot(c + d*x)**2 + 8*I*a**2*d*cot(c + d*x) - 4*a**2*d ), Eq(b, -I*a)), (A*d*x*cot(c + d*x)**2/(4*a**2*d*cot(c + d*x)**2 - 8*I*a* *2*d*cot(c + d*x) - 4*a**2*d) - 2*I*A*d*x*cot(c + d*x)/(4*a**2*d*cot(c + d *x)**2 - 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - A*d*x/(4*a**2*d*cot(c + d*x )**2 - 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - A*cot(c + d*x)/(4*a**2*d*cot( c + d*x)**2 - 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) + 2*I*A/(4*a**2*d*cot(c + d*x)**2 - 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - I*B*d*x*cot(c + d*x)**2/ (4*a**2*d*cot(c + d*x)**2 - 8*I*a**2*d*cot(c + d*x) - 4*a**2*d) - 2*B*d*x* cot(c + d*x)/(4*a**2*d*cot(c + d*x)**2 - 8*I*a**2*d*cot(c + d*x) - 4*a*...
Time = 0.44 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.67 \[ \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx=\frac {\frac {2 \, {\left (A a^{2} + 2 \, B a b - A b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (B a^{2} - 2 \, A a b - B b^{2}\right )} \log \left (a \tan \left (d x + c\right ) + b\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {{\left (B a^{2} - 2 \, A a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (B a b - A b^{2}\right )}}{a^{3} b + a b^{3} + {\left (a^{4} + a^{2} b^{2}\right )} \tan \left (d x + c\right )}}{2 \, d} \]
1/2*(2*(A*a^2 + 2*B*a*b - A*b^2)*(d*x + c)/(a^4 + 2*a^2*b^2 + b^4) + 2*(B* a^2 - 2*A*a*b - B*b^2)*log(a*tan(d*x + c) + b)/(a^4 + 2*a^2*b^2 + b^4) - ( B*a^2 - 2*A*a*b - B*b^2)*log(tan(d*x + c)^2 + 1)/(a^4 + 2*a^2*b^2 + b^4) + 2*(B*a*b - A*b^2)/(a^3*b + a*b^3 + (a^4 + a^2*b^2)*tan(d*x + c)))/d
Leaf count of result is larger than twice the leaf count of optimal. 241 vs. \(2 (111) = 222\).
Time = 0.35 (sec) , antiderivative size = 241, normalized size of antiderivative = 2.17 \[ \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx=\frac {\frac {2 \, {\left (A a^{2} + 2 \, B a b - A b^{2}\right )} {\left (d x + c\right )}}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} - \frac {{\left (B a^{2} - 2 \, A a b - B b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{4} + 2 \, a^{2} b^{2} + b^{4}} + \frac {2 \, {\left (B a^{3} - 2 \, A a^{2} b - B a b^{2}\right )} \log \left ({\left | a \tan \left (d x + c\right ) + b \right |}\right )}{a^{5} + 2 \, a^{3} b^{2} + a b^{4}} - \frac {2 \, {\left (B a^{4} \tan \left (d x + c\right ) - 2 \, A a^{3} b \tan \left (d x + c\right ) - B a^{2} b^{2} \tan \left (d x + c\right ) - A a^{2} b^{2} - 2 \, B a b^{3} + A b^{4}\right )}}{{\left (a^{5} + 2 \, a^{3} b^{2} + a b^{4}\right )} {\left (a \tan \left (d x + c\right ) + b\right )}}}{2 \, d} \]
1/2*(2*(A*a^2 + 2*B*a*b - A*b^2)*(d*x + c)/(a^4 + 2*a^2*b^2 + b^4) - (B*a^ 2 - 2*A*a*b - B*b^2)*log(tan(d*x + c)^2 + 1)/(a^4 + 2*a^2*b^2 + b^4) + 2*( B*a^3 - 2*A*a^2*b - B*a*b^2)*log(abs(a*tan(d*x + c) + b))/(a^5 + 2*a^3*b^2 + a*b^4) - 2*(B*a^4*tan(d*x + c) - 2*A*a^3*b*tan(d*x + c) - B*a^2*b^2*tan (d*x + c) - A*a^2*b^2 - 2*B*a*b^3 + A*b^4)/((a^5 + 2*a^3*b^2 + a*b^4)*(a*t an(d*x + c) + b)))/d
Time = 14.09 (sec) , antiderivative size = 268, normalized size of antiderivative = 2.41 \[ \int \frac {A+B \cot (c+d x)}{(a+b \cot (c+d x))^2} \, dx=\ln \left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )\,\left (\frac {B}{d\,\left (a^2+b^2\right )}-\frac {2\,B\,b^2}{d\,{\left (a^2+b^2\right )}^2}\right )+\frac {A\,\ln \left (\mathrm {cot}\left (c+d\,x\right )-\mathrm {i}\right )}{2\,\left (-1{}\mathrm {i}\,d\,a^2+2\,d\,a\,b+1{}\mathrm {i}\,d\,b^2\right )}-\frac {B\,\ln \left (\mathrm {cot}\left (c+d\,x\right )-\mathrm {i}\right )}{2\,\left (d\,a^2+2{}\mathrm {i}\,d\,a\,b-d\,b^2\right )}+\frac {A\,b}{\left (a\,d+b\,d\,\mathrm {cot}\left (c+d\,x\right )\right )\,\left (a^2+b^2\right )}-\frac {B\,a}{\left (a\,d+b\,d\,\mathrm {cot}\left (c+d\,x\right )\right )\,\left (a^2+b^2\right )}-\frac {2\,A\,a\,b\,\ln \left (a+b\,\mathrm {cot}\left (c+d\,x\right )\right )}{d\,{\left (a^2+b^2\right )}^2}+\frac {A\,\ln \left (\mathrm {cot}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,\left (-d\,a^2+2{}\mathrm {i}\,d\,a\,b+d\,b^2\right )}-\frac {B\,\ln \left (\mathrm {cot}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}}{2\,\left (1{}\mathrm {i}\,d\,a^2+2\,d\,a\,b-1{}\mathrm {i}\,d\,b^2\right )} \]
log(a + b*cot(c + d*x))*(B/(d*(a^2 + b^2)) - (2*B*b^2)/(d*(a^2 + b^2)^2)) + (A*log(cot(c + d*x) + 1i)*1i)/(2*(b^2*d - a^2*d + a*b*d*2i)) + (A*log(co t(c + d*x) - 1i))/(2*(b^2*d*1i - a^2*d*1i + 2*a*b*d)) - (B*log(cot(c + d*x ) - 1i))/(2*(a^2*d - b^2*d + a*b*d*2i)) - (B*log(cot(c + d*x) + 1i)*1i)/(2 *(a^2*d*1i - b^2*d*1i + 2*a*b*d)) + (A*b)/((a*d + b*d*cot(c + d*x))*(a^2 + b^2)) - (B*a)/((a*d + b*d*cot(c + d*x))*(a^2 + b^2)) - (2*A*a*b*log(a + b *cot(c + d*x)))/(d*(a^2 + b^2)^2)